<div class="top" id="tilteDiv">
    <div class="top-con w1200">
        <p class="t-con-l f-l" id="showLoginUserMsg"></p>
        <ul class="t-con-r f-r">
            <li><a href="#">我 (个人中心)</a></li>
            <li><a href="javascript:void(0)" onclick="getUserCarList()">我的购物车</a>
            </li>
            <li><a href="#">我的订单</a></li>
            <li class="erweima">
                <a href="#">扫描二维码</a>
                <div class="ewm-tu">
                    <a href="#"><img src="images/erweima-tu.jpg"/></a>
                </div>
            </li>
            <div style="clear:both;"></div>
        </ul>
        <div style="clear:both;"></div>
    </div>
</div>

<script type="text/javascript">
    function getUserCarList() {

        // 1.获取token
        var token = localStorage.getItem("2008-login-token");

        console.info(token);

        // 2.判断token是否有内容
        if(token){
            // 3.如何在js中发送一个请求,这里为什么不能使用ajax发送请求
            location.href = "http://localhost/shop-car/carController/getUserCarList?token="+token;
        }else{
            location.href = "http://localhost/shop-car/carController/getUserCarList";
        }


    }
</script>